package com.iyundao.io.mapper;

import com.iyundao.io.model.WishSubmit;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface WishSubmitMapper {
    @Insert({
        "insert into wishsubmit (id, submitnum, ",
        "partymemberid, submittime, ",
        "submitsumintegral)",
        "values (#{id,jdbcType=INTEGER}, #{submitnum,jdbcType=VARCHAR}, ",
        "#{partymemberid,jdbcType=INTEGER}, #{submittime,jdbcType=DATE}, ",
        "#{submitsumintegral,jdbcType=INTEGER})"
    })
    int insert(WishSubmit record);

    @InsertProvider(type= WishSubmitSqlProvider.class, method="insertSelective")
    int insertSelective(WishSubmit record);

    @Select("select * from wishsubmit where partymemberid=#{partymemberid,jdbcType=INTEGER}")
    WishSubmit selectByPartyMemberId(Integer partymemberid);

    @Delete("delete wishsubmit where id=#{id,jdbcType=INTEGER}")
    int del(Integer id);

    @Select("select * from wishsubmit")
    List<WishSubmit> selectAll();
}